import { fetchLeavelSelectLists, fetchLeavelSelectDetailInfo } from '../../fetch/modules/leaveSelect'

const state = {
    leaveSelectLists: [],
    leaveSelectDetailInfo: {}
}

const actions = {
    FETCH_LEAVE_SELECT_LISTS: ({ commit, state }, opt) => {
        return fetchLeavelSelectLists(opt).then(leave => commit('GET_LEAVE_SELECT_LISTS', { leave }))
    },
    FETCH_LEAVE_SELECT_DETAIL: ({ commit, state }, opt) => {
        return fetchLeavelSelectDetailInfo(opt).then(leave => commit('GET_LEAVE_SELECT_DETAIL_INFO', { leave }))
    },
  
}
const mutations = {
    GET_LEAVE_SELECT_LISTS: (state, { leave }) => {
        state.leaveSelectLists = leave.data;
    },
    GET_LEAVE_SELECT_DETAIL_INFO: (state, { leave }) => {
        state.leaveSelectDetailInfo = leave.data;
    },
    
}

const getters = {
    getLeaveSelectLists(state) {
        return state.leaveSelectLists;
    },
    getLeaveSelectDetailInfo(state) {
        return state.leaveSelectDetailInfo;
    },
  
}

export default {
    state,
    actions,
    mutations,
    getters
}